<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding:1px;">
		<t:datagrid name="zyEquipmentTypeList" checkbox="false" fitColumns="false" title="设备机型" treegrid="true" pagination="false" onDblClick="dbClick"
		actionUrl="cbsEquipmentApplyController.do?dataGridOfChooseEquipmentType" idField="id" fit="true" queryMode="group">
		   <t:dgCol title="主键"  field="id"  hidden="true" treefield="id"	 width="120"></t:dgCol>
		   <t:dgCol title="机型名"  field="typeDesc" 		treefield="text"	width="250"></t:dgCol>
		</t:datagrid>
	</div>
</div>
<script src = "webpage/com/zybk/zy_em_valida_rule/zyEmValidaRuleList.js"></script>		
<script type="text/javascript">
function dbClick(node){
    <%
  		String uuid = request.getParameter("uuid");
  		String id = request.getParameter("id");
    %>
    var uuid = '<%=uuid%>';//输出s2给js变量s
	var cbsServiceId='<%=id%>';
	if(!node.hasLeaf){
	    var id=node.id;
	    if(uuid=='w'){
            $("#a",top.myWindow.document).val(node.id);
		}else{
            $("#"+uuid,top.myWindow.document).val(node.id);
		}
		$("#"+uuid+"0",top.myWindow.document).val(node.text);
        $.ajax({
            url: "cbsServiceController.do?getItem",
            data: {
				"id":id,
				"cbsServiceId":cbsServiceId
            },
            cache: false,
            dataType: 'json',
            type: 'POST',
            error : function() {// 请求失败处理函数
            },
            success : function(data) {
                if(data==null){
                    if(uuid=='w'){
                        $("#witem",top.myWindow.document).hide();
                        $("#item",top.myWindow.document).show();
                        $("#itemDesc",top.myWindow.document).show();
                        $("#span",top.myWindow.document).hide();
                    }else{
                        $("#"+uuid+"item",top.myWindow.document).hide();
                        $("#"+uuid+"in",top.myWindow.document).show();
                        $("#"+uuid+"itemDesc",top.myWindow.document).show();
                        $("#"+uuid+"span",top.myWindow.document).hide();
					}
                }else{
                    if(uuid=='w'){
                        $("#witem",top.myWindow.document).html("");
                        var html="";
                        html+="<option value=''>请选择</option>";
                        for(a in data){
                            html+="<option value='"+data[a].id+"'>"+data[a].item+"</option>"
                        }
                        $("#witem",top.myWindow.document).html(html);
                        $("#witem",top.myWindow.document).show();
                        $("#item",top.myWindow.document).hide();
					}else{
                        $("#"+uuid+"item",top.myWindow.document).html("");
                        $("#"+uuid+"item",top.myWindow.document).show();
                        $("#"+uuid+"in",top.myWindow.document).hide();
                        var html="";
                        html+="<option value=''>请选择</option>";
                        for(a in data){
                            html+="<option value='"+data[a].id+"'>"+data[a].item+"</option>"
                        }
                        $("#"+uuid+"item",top.myWindow.document).append(html);
					}
				}
                frameElement.api.close();
            }
        });
	}else{
		tip("请选择正确的机型");
	}
}
</script>